package com.entity.def;

import com.ymx.darling.util.StringUtil;
import com.ymx.darling.wrapper.fragment.TableInfo;

public class UserRoleDef implements TableInfo {
	private static final String TABLE_NAME = "userRole";

	public static final UserRoleDef user_role = UserRoleDef.as("");

	private final String currentTableName;

	private final String aliaName;

	public final String role_id;

	public final String user_id;

	public final String[] default_columns;

	private UserRoleDef(String aliaName) {
		this.aliaName = aliaName;
		if (StringUtil.isNull(aliaName)) {
			aliaName = TABLE_NAME;
			currentTableName = TABLE_NAME;
		} else {
			currentTableName = TABLE_NAME + " AS " + aliaName;
		}
		this.role_id = aliaName + "." + "role_id";
		this.user_id = aliaName + "." + "user_id";
		this.default_columns = new String[]{role_id, user_id};
	}

	public static UserRoleDef as(String aliaName) {
		return new UserRoleDef(aliaName);
	}

	@Override
	public String getTableName() {
		return this.currentTableName;
	}

	@Override
	public String getAliaName() {
		return this.aliaName;
	}

}